<template>
  <view class="contain">
    <view class="navbar">
      <u-navbar title="个人中心" click="loginBtn" :autoBack="true"> </u-navbar>
    </view>
    <view class="content">
      <view class="pic">
        <image src="../../static/images/logo_icon.png" />
      </view>
      <view class="btn">
        <button @click="loginBtn">手机号快捷登录-内测版</button>
      </view>
      <view class="text">
        <p>登录/注册即视为你同意《服务条款》和《小兔鲜儿隐私协议》</p>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {
    async loginRequest() {
      const res = await uni.$u.http.post("/login/wxMin/simple", {
        phoneNumber: "16868686868",
      });
        console.log(res.data.result.token)
      uni.$emit('update', res.data.result)
      uni.setStorage({
        key: "tokenStorage",
        data: res.data.result.token,
        success: function () {
          uni.switchTab({
            url: "/pages/my/index",
          });
        },
      });
    },
    loginBtn() {
      this.loginRequest();
      uni.removeStorage({
        key: "tokenStorage",
        // success: function (res) {
        //   console.log("success");
        // },
      });
    },
  },
};
</script>

<style lang="scss">
.contain {
  background-color: rgba(217, 213, 213, 0.927);
  .content {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 600px;
    background-color: #fff;
    .pic {
      margin-top: 100px;
      image {
        width: 100px;
        height: 100px;
      }
    }
    .btn {
      width: 260px;
      button {
        width: 100%;
        height: 40px;
        background-color: #0ecfa5;
        border-radius: 20px;
        font-size: 12px;
        color: #fff;
        line-height: 40px;
      }
    }
    .text {
      text-align: center;
      p {
        font-size: 10px;
        color: rgb(167, 165, 165);
      }
    }
  }
}
</style>